home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / GameboyDev / GBDK / include / drawing.h < prev    next >
C/C++ Source or Header  |  1999-03-29  |  3KB  |  116 lines

  1. /*
  2.     drawing.h
  3.  
  4.     All Points Addressable (APA) mode drawing library.
  5.  
  6.     Drawing routines originally by Pascal Felber
  7.     Legendary overhall by Jon Fuge <jonny@q-continuum.demon.co.uk>
  8.     Commenting by Michael Hope
  9.  
  10.     Note that the standard text printf() and putchar() cannot be used
  11.     in APA mode - use gprintf() and wrtchr() instead.
  12. */
  13. #ifndef __DRAWING_H
  14. #define __DRAWING_H
  15.  
  16. /* Size of the screen in pixels */
  17. #define GRAPHICS_WIDTH    160
  18. #define GRAPHICS_HEIGHT 144
  19.  
  20. /* Possible drawing modes */
  21. #if ORIGINAL
  22.     #define    SOLID    0x10        /* Overwrites the existing pixels */
  23.     #define    OR    0x20        /* Performs a logical OR */
  24.     #define    XOR    0x40        /* Performs a logical XOR */
  25.     #define    AND    0x80        /* Performs a logical AND */
  26. #else
  27.     #define    SOLID    0x00        /* Overwrites the existing pixels */
  28.     #define    OR    0x01        /* Performs a logical OR */
  29.     #define    XOR    0x02        /* Performs a logical XOR */
  30.     #define    AND    0x03        /* Performs a logical AND */
  31. #endif
  32.  
  33. /* Possible drawing colours */
  34. #define    WHITE    0
  35. #define    LTGREY    1
  36. #define    DKGREY    2
  37. #define    BLACK    3
  38.  
  39. /* Possible fill styles for box() and circle() */
  40. #define    M_NOFILL    0
  41. #define    M_FILL        1
  42.  
  43. /* Possible values for signed_value in gprintln() and gprintn() */
  44. #define SIGNED   1
  45. #define UNSIGNED 0
  46.  
  47. #include <types.h>
  48.  
  49. /* Note:  all 
  50. /* Print the string 'str' with no interpretation */
  51. void
  52.     gprint(char *str);
  53.  
  54. /* Print the long number 'number' in radix 'radix'.  signed_value should
  55.    be set to SIGNED or UNSIGNED depending on whether the number is signed
  56.    or not */
  57. void
  58.     gprintln(WORD number, BYTE radix, BYTE signed_value);
  59.  
  60. /* Print the number 'number' as in 'gprintln' */
  61. void    
  62.     gprintn(BYTE number, BYTE radix, BYTE signed_value);
  63.  
  64. /* Print the formatted string 'fmt' with arguments '...' */
  65. BYTE    
  66.     gprintf(char *fmt,...);
  67.  
  68. /* Old style plot - try plot_point() */
  69. void
  70.     plot(UBYTE x, UBYTE y, UBYTE colour, UBYTE mode);
  71.  
  72. /* Plot a point in the current drawing mode and colour at (x,y) */
  73. void    
  74.     plot_point(UBYTE x, UBYTE y);
  75.  
  76. /* I (MLH) have no idea what switch_data does... */
  77. void
  78.     switch_data(UBYTE x, UBYTE y, unsigned char *src, unsigned char *dst);
  79.  
  80. /* Ditto */
  81. void    
  82.     draw_image(unsigned char *data);
  83.  
  84. /* Draw a line in the current drawing mode and colour from (x1,y1) to (x2,y2) */
  85. void    
  86.     line(UBYTE x1, UBYTE y1, UBYTE x2, UBYTE y2);
  87.  
  88. /* Draw a box (rectangle) with corners (x1,y1) and (x2,y2) using fill mode
  89.    'style' (one of NOFILL or FILL */
  90. void    
  91.     box(UBYTE x1, UBYTE y1, UBYTE x2, UBYTE y2, UBYTE style);
  92.  
  93. /* Draw a circle with centre at (x,y) and radius 'radius'.  'style' sets
  94.    the fill mode */
  95. void    
  96.     circle(UBYTE x, UBYTE y, UBYTE radius, UBYTE style);
  97.  
  98. /* Returns the current colour of the pixel at (x,y) */
  99. UBYTE    
  100.     getpix(UBYTE x, UBYTE y);
  101.  
  102. /* Prints the character 'chr' in the default font at the current position */
  103. void    
  104.     wrtchr(char chr);
  105.  
  106. /* Sets the current text position to (x,y).  Note that x and y have units
  107.    of cells (8 pixels) */
  108. void
  109.     gotogxy(UBYTE x, UBYTE y);
  110.  
  111. /* Set the current foreground colour (for pixels), background colour, and
  112.    draw mode */
  113. void    color(UBYTE forecolor, UBYTE backcolor, UBYTE mode);
  114.  
  115. #endif /* __DRAWING_H */
  116.